var newvue = new Vue({
	el: "body",
	data: {
		shop: [],
		htm: ""
	},
	methods: {
		back: function() {
			window.history.back()
		},
		oneshopid: function(index) {
			location.href = "../shop/shop.html?shopId=" + this.shop[index].id
		}
	}
})
stay()

function stay() {
	var APP_ID = 'c4w6bVvWfh8xxcmkBE1G0gIt-gzGzoHsz';
	var APP_KEY = 'JBikg4Ksk76zcTi5BKYWvTJF';
	AV.init({
		appId: APP_ID,
		appKey: APP_KEY
	});
}
var href = jiLu(location.search, "class");
newvue.htm = href

function jiLu(url, name) {
	c_start = url.indexOf(name + "=") //RetUrl= //1
	if(c_start != -1) {
		c_start = c_start + name.length + 1 //8
		c_end = url.indexOf("&", c_start) //16
		if(c_end == -1) c_end = url.length
		return decodeURI(url.substring(c_start, c_end))
	}
	return ""
}
query()

function query() {
	var query = new AV.Query('ELM_shop');
	query.contains('classify', href);
	query.find().then(function(todo) {
		console.log(todo)
		for(var i = 0; i < todo.length; i++) {
			jop = {
				img: todo[i].attributes.shopimg,
				name: todo[i].attributes.shopname,
				grade: todo[i].attributes.grade,
				salenum: todo[i].attributes.salenum,
				sendprice: todo[i].attributes.sendprice,
				startprice: todo[i].attributes.startprice,
				id: todo[i].id
			}
			newvue.shop.push(jop)
		}
		console.log(newvue.shop)
	}, function(error) {
		// 异常处理
	});
}